Skip to content

Fix vote handler rejecting valid votes due to concurrent#527

Open
walterzhaoJR wants to merge 1 commit intobaidu:masterfrom
walterzhaoJR:fix-526
Open

Fix vote handler rejecting valid votes due to concurrent#527
walterzhaoJR wants to merge 1 commit intobaidu:masterfrom
walterzhaoJR:fix-526

Conversation

@walterzhaoJR
Copy link
Contributor

Fix vote handler rejecting valid votes due to concurrent

In handle_request_vote_request, the mutex is released to fetch last_log_id (blocking I/O). During this unlock window, a concurrent heartbeat response with a higher term can trigger step_down, advancing _current_term. The original ABA check unconditionally rejected the vote when _current_term changed, even if the vote request was still valid for the new term.

Refine the ABA check to only reject votes when _current_term has surpassed request->term() (vote is stale). If term changed but request->term() is still >= new term, update saved_current_term and continue processing.

detail:#526

Fix vote handler rejecting valid votes due to concurrent

In handle_request_vote_request, the mutex is released to fetch last_log_id
(blocking I/O). During this unlock window, a concurrent heartbeat response
with a higher term can trigger step_down, advancing _current_term. The
original ABA check unconditionally rejected the vote when _current_term
changed, even if the vote request was still valid for the new term.

Refine the ABA check to only reject votes when _current_term has surpassed
request->term() (vote is stale). If term changed but request->term() is
still >= new term, update saved_current_term and continue processing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant